test: Nested NetworkObjects in prefabs throws a warning [MTT-2976]#1969
test: Nested NetworkObjects in prefabs throws a warning [MTT-2976]#1969
Conversation
|
Hi @TwoTenPvP, in our project we have Prefabs that have root a NetworkObject and nested NetworkObjects. We've handled them with a component that will unparent them on Awake (upon instantiation, but before network spawning) and that will Spawn them on the next network tick following the network spawning of the root NetworkObject. On the client side, we have a PrefabHandler registered dynamically that will provide the nested NetworkObject instance, the one obtained from the prefab instantiation and that was unparented on Awake, to the spawn call therefore binding their network "identities" without doing an extra instantiation / duplication. It allows us to have nested NetworkObjects in the editor (in the prefabs) which help us visualizing / positioning them, but as soon as their parent is spawn, they are unparented and spawned as well without duplication (we bind the existing instance, not doing another Instantiate). We find that pretty convenient. Are you sure you want to enforce such restrictions with an editor check? How about a warning instead? 👀 |
Hello! It has been done with a warning now. |
Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
Prevents nested NetworkObjects from existing and being created.
MTT-2976
Changelog
Testing and Documentation